package com.skwen.delivery.superdelivery.order.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.skwen.delivery.superdelivery.R;
import com.skwen.delivery.superdelivery.order.bean.WriteOrder;

import java.util.List;

/**
 * Created by skwen on 2017/11/18.
 * SuperDelivery
 */

public class WriteOrderAdapter extends RecyclerView.Adapter<WriteOrderHolder> {

    List<WriteOrder> mList;

    public WriteOrderAdapter(List<WriteOrder> mList) {
        this.mList = mList;
    }

    @Override
    public WriteOrderHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.write_order_adapter_item, parent, false);
        return new WriteOrderHolder(view);
    }

    @Override
    public void onBindViewHolder(WriteOrderHolder holder, int position) {
        WriteOrder item = mList.get(position);
        if (item != null) {
            holder.bindData(item);
        }
    }

    @Override
    public int getItemCount() {
        return mList.size();
    }
}
